#ifndef MG_GEOMETRY_ARE_PARALLEL_H
#define MG_GEOMETRY_ARE_PARALLEL_H

#include <boost/geometry/util/math.hpp>

#include "vector_math.h"

namespace mg
{
    namespace geometry
    {
	    // TODO: expand to segment/segment, vec/poly, segment/poly, poly/poly
	    template<typename T1, typename T2, typename Tolerance>
	    inline bool are_parallel(const T1& a, const T2& b)
	    {
            typedef typename select_coordinate_type_fp<T1, T2>::type T;
	        T d = dot_product(a, b);

	        return mg::geometry::equals_with_epsilon<T, T, Tolerance>(d * d,
                dot_product(a, a) * dot_product(b, b));

            // return mg::geometry::equals_with_epsilon<T, T, Tolerance>(ttmath::Abs(d), ttmath::Sqrt(dot_product(a, a) * dot_product(b, b)));
	    }

        template<typename T1, typename T2>
        inline bool are_parallel(const T1& a, const T2& b)
        {
            typedef typename boost::geometry::select_coordinate_type<T1, T2>::type T;

            return are_parallel<T1, T2, T>(a, b);
        }
    }
}

#endif